package movement;

import jgame.JGObject;

public class WallBounce implements MoveModel {

	private static final WallBounce instance = new WallBounce();
	
	private WallBounce(){}
	
	@Override
	public void move(JGObject obj) {

		// TODO: add size consideration for proper bounce on
		// right/bottom sides - perhaps an interface implementing JGO
		// while providing a 'getWidth' or similar.
		if ((obj.x > JGObject.pfwidth && obj.xspeed > 0)
				|| (obj.x < 0 && obj.xspeed < 0)) {
			obj.xspeed = -(obj.xspeed / 1.2);

		}
		if ((obj.y > JGObject.pfheight && obj.yspeed > 0)
				|| (obj.y < 0 && obj.yspeed < 0)) {
			obj.yspeed = -(obj.yspeed / 2);

		}
	}

	public static MoveModel getInstance(){
		return instance;
	}
}
